import defineSessionEventHandler from '~/server/utils/session_verify';
import { findChatsBySessionId } from "../db/chat";

export default defineSessionEventHandler(async event => {
    const { _id: session_id } = event.context.session;

    // select messages
    const data = await findChatsBySessionId(session_id);

    return { code: 0, data, msg: 'OK' };
});